#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time         : 17-12-4 下午7:19
# @Author       : xiaohan
# @File         : SQLAlchemy_demo.py
# @desc         : 

'''
https://www.cnblogs.com/pycode/p/mysql-orm.html
https://linux-wang.gitbooks.io/sqlalchemy-docs-cn/content/SQLAlchemyORM/Object-Relational-Tutorial.html

'''

import sqlalchemy
from sqlalchemy import create_engine, Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base

version = sqlalchemy.__version__
print(version)
''

Base = declarative_base()

url = 'mysql+pymysql://root:xiaohan@localhost:3306/sqlalchemy'
conn = engine = create_engine(url, echo=True,encoding='utf-8')
print(conn)


class User(Base):
    __tablename__ = 'users'
    id = Column(Integer, primary_key=True)
    name = Column(String)
    password = Column(String)


